package 工厂模式;

public class ShapeFactory {

    public Shape getShape(String shapeType){
        // 判断类型
        if (shapeType == null){
            return null;
        }

        if (shapeType.equalsIgnoreCase("Circle")){
            return new Circle();
        } else if (shapeType.equalsIgnoreCase("Rectangle")){
            return new Rectangle();
        } else if (shapeType.equalsIgnoreCase("Square")){
            return new Square();
        }

        return null;
    }
}
